package com.weapp.common.config;

import com.weapp.common.config.properties.MinioProperties;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author jsy
 * @description: minio配置类
 * @date 2022/7/12 11:10
 */
@Configuration
public class MinioConfig {

  @Autowired(required = false)
  private MinioProperties minioProperties;

  @Bean
  public MinioClient minioClient() {
    MinioClient minioClient = MinioClient.builder()
      .endpoint(minioProperties.getEndPoint())
      .credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey())
      .build();
    return minioClient;
  }
}
